package flc.ast.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyLetterBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class LetterAdapter extends StkProviderMultiAdapter<MyLetterBean> {

    public LetterAdapter() {
        addItemProvider(new StkSingleSpanProvider(20));
        addItemProvider(new LetterProvider());
    }

    private class LetterProvider extends BaseItemProvider<MyLetterBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_letter;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyLetterBean bean) {
            baseViewHolder.setText(R.id.tvLetterItemText, bean.getLetter());
            if (bean.isSelect()) {
                baseViewHolder.setTextColor(R.id.tvLetterItemText, Color.parseColor("#7B6CFF"));
            } else {
                baseViewHolder.setTextColor(R.id.tvLetterItemText, Color.parseColor("#B0B0B0"));
            }
        }
    }
}
